package entity;

import org.hibernate.annotations.*;
import org.hibernate.annotations.Cache;

import javax.persistence.*;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * Created by xuweijie on 17-5-8.
 */
@Entity
@Table(name = "sys_citys")
//@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class SysCitys implements Serializable{
    private int id;
    private SysProvience province;
    private String name;
    private String code;

    @Id
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @ManyToOne(cascade ={CascadeType.REFRESH},fetch =FetchType.EAGER)
    @JoinColumn(name ="provinceid",referencedColumnName = "id")
    public SysProvience getProvince() {
        return province;
    }

    public void setProvince(SysProvience province) {
        this.province = province;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}
